//
//  HUDViewController.swift
//  CustormHUD
//
//  Created by youmy on 2018/8/15.
//  Copyright © 2018年 youmy. All rights reserved.
//

import UIKit

class HUDViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
        
        switch indexPath.row {
        case 0:
            HUD.shared.showText(text: "加载中...")
            return
        case 1:
            HUD.shared.showLoadingText(text: "加载中...")
        case 2:
            HUD.shared.showResult(image: "success", content: "加载成功")
        case 3:
            HUD.shared.showResult(image: "failure", content: "加载失败")
        case 4:
            HUD.shared.showGIFLoading()
        case 5:
            HUD.shared.showLoading()
        case 6:
            HUD.shared.showText(text: "加载中...", bgColor: .red, foregroundColor: .white, position: .top, second: DispatchTime.now() + 3)
            return
        case 7:
            HUD.shared.showText(text: "加载中...", bgColor: .orange, foregroundColor: .white, position: .bottom, second: DispatchTime.now() + 3)
            return
        default:
            break
        }
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 3) {
            HUD.shared.removeLoading()
        }
    }
}
